# FROM python:3.12.7-slim-bookworm # 它没有 curl/wget/du 等工具
FROM python:3.12.7

WORKDIR /code

# docker run -e POETRY_VERSION=1.8.4 myimage
# docker build --build-arg POETRY_VERSION=1.8.4 -t myimage .
ENV POETRY_VERSION=1.8.4

RUN pip install --no-cache-dir poetry==${POETRY_VERSION}

RUN poetry config virtualenvs.create false

COPY ./pyproject.toml ./README.md ./poetry.lock* ./

RUN poetry install  --no-interaction --no-ansi --no-root

COPY ./app ./app

RUN poetry install --no-interaction --no-ansi --no-cache

EXPOSE 8080

CMD exec uvicorn app.server:app --host 0.0.0.0 --port 8080 --workers ${APP_WORKERS:-1}
